#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	string s;
	cin>>s;
	if(s.find('+') == -1 || s.find('-') == -1)
	{
		cout<<0;
		return 0;
	}
	int l = s.find('+');
	string t = s;
	reverse(t.begin(), t.end());
	int r = s.size()-t.find('-')-1;
	int ans = 0;
	for(int i = l;i < r;i++)
	{
		int sum = 0;
		if(s[i] == '-')
			continue;
		for(int j = i;j <= r;j++)
		{
			if(s[j] == '+')
				sum++;
			else
				sum--;
			if(!sum)
				ans++;
			else if(sum < 0)
				break;
		}
	}
	cout<<ans;
	return 0;
}

